"""
管理员的接口调用
"""
from flask import jsonify,request
from main.utils import SWJsonify
from . import bp
from main.public.models import ProductHistory,DetailList

@bp.route('/api/get_miner_list')
def api_miner_list():
    """矿机记录"""
    history = ProductHistory.query.all()
    return SWJsonify({'result':history})


@bp.route('/api/get_cash_list')
def api_cash_list():
    """货币明细列表"""
    detail = DetailList.query.all()
    return SWJsonify({'result':detail})


@bp.route('/api/cash_monenychange_post',methods=["POST"])
def cash_monenychange_post():
    """货币增减提交"""
    btype = request.form["btype"]
    action = request.form["action"]
    user = request.form["user"]
    price = request.form["price"]
    note = request.form["note"]

    print(request.form)
    detail = DetailList.query.all()
    return SWJsonify({'result':detail})

